home *** CD-ROM | disk | FTP | other *** search
/ Family Forum 262 / SOMC Family Forum 262.iso / Xtras / Widget Wizard / Widget Wizard.dir / WidgtBehaviors_94_Next Message Sprite .ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  4.4 KB  |  126 lines

  1. property whichevent, Addressee, EventToSend, button_active, downNextCM, upNextCM, disNextCM, downNextNum, upNextNum, disNextNum, totalCount, currentCount, PrevButtonSprite, spriteNum, TextSprite
  2.  
  3. on getPropertyDescriptionList
  4.   set description to [:]
  5.   if the currentSpriteNum = 0 then
  6.     set memdefault to 0
  7.     set disdefault to 0
  8.   else
  9.     set memref to the member of sprite the currentSpriteNum
  10.     set castLibNum to the castLibNum of memref
  11.     set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
  12.     set disdefault to member (the memberNum of member memref + 2) of castLib castLibNum
  13.   end if
  14.   addProp(description, #TextSprite, [#comment: "Text Target Sprite:", #format: #integer, #default: the currentSpriteNum - 2])
  15.   addProp(description, #whichevent, [#comment: "Triggering Event:", #format: #symbol, #range: [#mouseUp, #mouseDown, #prepareFrame, #enterFrame, #exitFrame], #default: #mouseUp])
  16.   addProp(description, #downNextCM, [#comment: "Down state of button: ", #format: #bitmap, #default: memdefault])
  17.   addProp(description, #disNextCM, [#comment: "Disabled state of button: ", #format: #bitmap, #default: disdefault])
  18.   addProp(description, #PrevButtonSprite, [#comment: "What channel is Previous Button: ", #format: #integer, #default: the currentSpriteNum - 1])
  19.   addProp(description, #totalCount, [#comment: "How many text fields: ", #format: #integer, #default: 1])
  20.   return description
  21. end
  22.  
  23. on getBehaviorDescription
  24.   return "Send a Message to the designated Sprite when the specified Event occurs.  At its destination the message will be interpreted as a sprite event and any actions defined for that event will be invoked." & RETURN & "PARAMETERS:" & RETURN & "ΓÇó Message - name of event to invoke at target sprite." & RETURN & "ΓÇó Target Sprite - number of sprite channel to which message should be sent." & RETURN & "ΓÇó Triggering Event - event that should cause message to be sent." & RETURN & "NOTES:" & RETURN & "If the target sprite does not handle the message it will propagate to the cast member script, the current frame script, and then the movie, in search of a handler for that event."
  25. end
  26.  
  27. on getAssocMembers
  28.   set myPropList to [downNextCM, disNextCM]
  29.   return myPropList
  30. end
  31.  
  32. on beginSprite me
  33.   set the upNextCM of me to the member of sprite the spriteNum of me
  34.   set the upNextNum of me to the number of member upNextCM
  35.   set the downNextNum of me to the number of member downNextCM
  36.   set the disNextNum of me to the number of member disNextCM
  37.   set the button_active of me to 0
  38.   set the currentCount of me to 1
  39. end
  40.  
  41. on endSprite me
  42.   puppetSprite(the spriteNum of me, 0)
  43. end
  44.  
  45. on triggerSendSprite me
  46.   trigger(me)
  47. end
  48.  
  49. on checkbutton me
  50.   set currentCount to the currentCount of sprite(the TextSprite of me)
  51.   if currentCount = totalCount then
  52.     set the member of sprite the spriteNum of me to disNextNum
  53.   else
  54.     set the member of sprite the spriteNum of me to upNextNum
  55.   end if
  56. end
  57.  
  58. on mouseUp me
  59.   if the number of member the member of sprite the spriteNum of me = disNextNum then
  60.     exit
  61.   end if
  62.   set the member of sprite the spriteNum of me to upNextNum
  63.   set the button_active of me to 0
  64.   if whichevent = #mouseUp then
  65.     trigger(me)
  66.   end if
  67. end
  68.  
  69. on mouseDown me
  70.   if the number of member the member of sprite the spriteNum of me = disNextNum then
  71.     exit
  72.   end if
  73.   set the member of sprite the spriteNum of me to downNextNum
  74.   set the button_active of me to 1
  75.   if whichevent = #mouseDown then
  76.     trigger(me)
  77.   end if
  78. end
  79.  
  80. on mouseUpOutSide me
  81.   if the number of member the member of sprite the spriteNum of me = disNextNum then
  82.     exit
  83.   end if
  84.   set the button_active of me to 0
  85. end
  86.  
  87. on mouseLeave me
  88.   if the number of member the member of sprite the spriteNum of me = disNextNum then
  89.     exit
  90.   end if
  91.   if the button_active of me then
  92.     set the member of sprite the spriteNum of me to upNextNum
  93.   end if
  94. end
  95.  
  96. on mouseEnter me
  97.   if the number of member the member of sprite the spriteNum of me = disNextNum then
  98.     exit
  99.   end if
  100.   if the button_active of me then
  101.     set the member of sprite the spriteNum of me to downNextNum
  102.   end if
  103. end
  104.  
  105. on prepareFrame me
  106.   if whichevent = #prepareFrame then
  107.     trigger(me)
  108.   end if
  109. end
  110.  
  111. on enterFrame me
  112.   if whichevent = #enterFrame then
  113.     trigger(me)
  114.   end if
  115. end
  116.  
  117. on exitFrame me
  118.   if whichevent = #exitFrame then
  119.     trigger(me)
  120.   end if
  121. end
  122.  
  123. on trigger me
  124.   sendSprite(the TextSprite of me, #advanceText)
  125. end
  126.